﻿/*
https://github.com/nakupanda/bootstrap3-dialog
*/
function ShowModal(id, url, showloading, hideCallback) {

    var $modal = $(id);

    if(showloading)
      $('body').modalmanager('loading');

    setTimeout(function () {

        $(".modal-body").empty();

        $("<iframe id='iframeModal' frameBorder=\"0\" src='" + url + "' style=\"width:700px; height:600px\" ></iframe>")
            .appendTo(".modal-body").css({
                'max-height': '100%',
                'max-width': '100%'
            });

        $modal.modal().on('hidden.bs.modal', function () {
            if (hideCallback !== undefined) {
                hideCallback();
            }
        });

    }, 500);

}

function ShowModalYesNo(id, text, callback) {

    var $modal = $(id);

    $(".modal-body").empty().html(text).css({
            'max-height': '100%',
            'max-width': '100%'
        });

    $modal.modal('show').on('click', '#delete', function () {
        if (callback !== undefined) {
            callback();
        }
    });

}